package com.financing.platform.service.impl;


import java.sql.SQLException;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.financing.platform.dao.IXcxNewsDao;
import com.financing.platform.dto.XcxNewsDTO;
import com.financing.platform.service.IXcxNewsService;
import com.financing.platform.util.DTOdateSet;
/**
 * xcx_news  
 * 小程序消息通知 业务访问层实现类
 * @author huqiyun
 *
 */
 
@Repository("xcxNewsService")
public class XcxNewsServiceImpl implements IXcxNewsService{

	@Autowired
	private IXcxNewsDao xcxNewsDao;

	@Override
	public int insert(XcxNewsDTO xcxNews) throws SQLException {
//		DTOdateSetUtil.setCreateInfo(xcxNews);
//		DTOdateSetUtil.setUpdateInfo(xcxNews);
//		xcxNews.setDeleteTag(CommonStatus.DELETE_TAG_NORMAL);
		return xcxNewsDao.insert(xcxNews);
	}

	@Override
	public void update(XcxNewsDTO xcxNews) throws SQLException {
//		DTOdateSetUtil.setUpdateInfo(xcxNews);
		xcxNewsDao.update(xcxNews);
	}

	@Override
	public void updateForce(XcxNewsDTO xcxNews) throws SQLException {
//		DTOdateSetUtil.setUpdateInfo(xcxNews);
		xcxNewsDao.updateForce(xcxNews);
	}

	@Override
	public void delete(Integer id) throws SQLException {
		xcxNewsDao.delete(id);
	}
	
	@Override
	public List<XcxNewsDTO> queryList(XcxNewsDTO xcxNews) throws SQLException {
		return xcxNewsDao.queryList(xcxNews);
	}

	@Override
	public int queryListCount(XcxNewsDTO xcxNews) throws SQLException {
		return xcxNewsDao.queryListCount(xcxNews);
	}

	@Override
	public XcxNewsDTO loadById(Integer id) throws SQLException {
		return xcxNewsDao.loadById(id);
	}
 	@Override
	public XcxNewsDTO queryListGetFirst(XcxNewsDTO xcxNews)
			throws SQLException {
		 List<XcxNewsDTO> queryList = queryList(xcxNews);
		 if(queryList==null||queryList.size()==0){
			 return new XcxNewsDTO();
		 }
		 return queryList.get(0);
	}
}
